/**
 * Created by lixiaodi on 2019/06/06 0027.
 */
var seeMailInfo = localStorage.getItem("seeMailInfo");
seeMailInfo = JSON.parse(seeMailInfo);
mini.parse();
var form = new mini.Form("form1");  			//得到页面上的表单
var ue = UE.getEditor('content',{
	//设置不自动增加高度
	scaleEnabled:true
});				//富文本编辑器
var againSendBtn = mini.get('againSend');		//再次发送
var replayBtn = mini.get('replay');				//转发
//初始化
$(function(){
	//设置禁用
	ue.addListener('ready',function(){
		//设置编辑器只读
		ue.setDisabled('fullscreen');
		//这是编辑器溢出滚动
		ue.body.style.overflow = 'auto';
	});
	
	//判断是否传值
	if(seeMailInfo){
		//收件箱请求
		if(seeMailInfo.types == 'inbox'){
			//隐藏再次发送
			//$('#againSend').hide();
			againSendBtn.hide();
			form.setData(seeMailInfo);
			//消息详情赋值
	    	ue.addListener('ready',function(){
	    		ue.setContent(seeMailInfo.msg_text);
	    	});
		//发件箱	
		}else if(seeMailInfo.types == 'outbox'){
			//隐藏回复
			//$('#replay').hide();
			replayBtn.hide();
			//赋值
			form.setData(seeMailInfo);
			//消息详情赋值
	    	ue.addListener('ready',function(){
	    		ue.setContent(seeMailInfo.msg_text);
	    	});
		}
	}else{
		console.log('传值失败');
	}
	
});
//转发
function onForward(){
	console.log('转发');
	seeMailInfo.types = '转发';
	//将需要编辑的数据带过去
	localStorage.setItem("mailData",JSON.stringify(seeMailInfo));
	onJump('转发邮件');
}
//回复
function onReply(){
	console.log('回复');
	seeMailInfo.types = '回复';
	//将需要编辑的数据带过去
	localStorage.setItem("mailData",JSON.stringify(seeMailInfo));
	onJump('回复邮件');
}
//跳转函数
function onJump(text){
	//跳转
	var item = {
		id: 'reply',
	    iconCls: "fa fa-desktop",
	    text: text,
	    url: "../pages/booking/Mail/mAddAndEdit.html"
	};
	//var data = parent.allTabs();
	parent.activeTab(item);//与父页面通信
}